<template>
	<scroll-view class="content" scroll-y="true" @scrolltolower="getMore()">
		<view class="previousItem" v-for="(item,index) in data" :key="index" @click="$navto.navto('/pages/activity_info/activity_info',{id:item.id,type:2})">
			<image :src="item.title_img" class="poster"></image>
			<text class="name ellipsis">{{item.name}}</text>
			<text class="time">{{$timestampToTime(item.start_time)}} - {{$timestampToTime(item.end_time)}}</text>
		</view>
	</scroll-view>
</template>
<script>
	export default {
		data() {
			return {
				data: [],
				page: 1
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getMore() {
				console.log("加载更多")
				this.page++;
				this.getData();
			},
			getData() {
				this.$request.get(`activity_list?status=2&page=${this.page}`).then(res => {
					this.data.push(...res.data.data);
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.previousItem {
		width: 670rpx;
		margin-right: 30rpx;
		display: flex;
		flex-direction: column;
		margin-bottom: 50rpx;

		.time {
			font-weight: 500;
			font-size: 22rpx;
			color: #8E8E8E;
			margin-top: 20rpx;
		}

		.name {
			font-weight: 900;
			width: 100%;
			font-size: 28rpx;
			color: #121212;
			margin-top: 20rpx;
		}

		.poster {
			width: 670rpx;
			height: 467rpx;
		}
	}

	.content {
		width: 100%;
		height: 100vh;
		margin-left: 40rpx;
		padding-bottom: 100rpx;
		overflow-x: scroll;
		margin-top: 50rpx;
		display: flex;
		flex-direction: column;
	}
</style>